package com.sline.Template;

public class Demo1_Template {
    public static void main(String[] args) {
//        long start = System.currentTimeMillis();
//        for (int i = 0; i < 1000000; i++) {
//            System.out.println("x");
//        }
//        long end = System.currentTimeMillis();
//        System.out.println(end - start);

        Demo demo = new Demo();
        long time = demo.getTime();
        System.out.println(time);
    }
}

abstract class GetTime {
    public final long getTime() {
        long start = System.currentTimeMillis();
        code();
        long end = System.currentTimeMillis();
        return end - start;
    }

    public abstract void code();
}

class Demo extends GetTime {
    @Override
    public void code() {
        for (int i = 0; i < 100000; i++) {
            System.out.println("1");
        }
    }
}